<%--
  Created by IntelliJ IDEA.
  User: 10332
  Date: 2020/8/7
  Time: 15:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt"  prefix="T"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="ft"%>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>添加考勤</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="${AppPath}/css/font.css">
    <link rel="stylesheet" href="${AppPath}/css/index.css">
    <script type="text/javascript" src="${AppPath}/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${AppPath}/js/index.js"></script>
    <link rel="stylesheet" href="${AppPath}/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${AppPath}/css/font-awesome.min.css">
    <link rel="stylesheet" href="${AppPath}/layer/skin/default/layer.css">

</head>

<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form" id="updateForm">

            <input type="hidden" name="rewardId" id="rewardId" value="${reward.rewardId}">

            <div class="layui-form-item">
                <label for="studentName" class="layui-form-label">
                    <span class="x-red">*</span>学生名</label>
                <div class="layui-input-inline">
                    <select id="studentName" name="studentId" class="valid">
                        <T:forEach items="${studentList}" var="student">
                        <option value="${student.studentId}" <T:if test="${student.studentId==attendence.studentId}">selected="selected"</T:if>}>${student.studentName}</option>
                        </T:forEach>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="className" class="layui-form-label">
                    <span class="x-red">*</span>班级名</label>
                <div class="layui-input-inline">
                    <select id="className" name="classId" class="valid">
                        <T:forEach items="${classList}" var="class1">
                            <option value="${class1.classId}" <T:if test="${class1.classId==attendence.classId}">selected="selected"</T:if>>${class1.className}</option>
                        </T:forEach>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="rewardThings" class="layui-form-label">
                    <span class="x-red">*</span>奖惩</label>
                <div class="layui-input-inline">
                    <input type="text" id="rewardThings" name="rewardThings"  class="layui-input" value="${reward.rewardThings}"></div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label for="rewardReason" class="layui-form-label">奖惩原因</label>
                <div class="layui-input-block">
                    <input type="text" placeholder="请输入内容" id="rewardReason" name="rewardReason" class="layui-textarea" value="${reward.rewardReason}" >
                </div>
            </div>

            <div class="layui-form-item">
                <label for="update" class="layui-form-label"></label>
                <button id="update" type="button" onclick="updateSave()" lay-filter="update"  class="layui-btn">修改</button>
                <button type="reset" class="layui-btn">重置</button>
            </div>
        </form>
    </div>
</div>
<script src="${AppPath}/jquery/jquery-2.1.1.min.js"></script>
<script src="${AppPath}/bootstrap/js/bootstrap.min.js"></script>
<script src="${AppPath}/script/docs.min.js"></script>
<script src="${AppPath}/layer/layer.js"></script>
<script>layui.use(['form', 'layer'],function () {});

    function updateSave() {
        $.ajax({
            url:"${AppPath}/reward/updateById",
            type:"post",
            data:$("#updateForm").serialize(),
            success:function (data) {
                if(data.result=="ok"){
                    layer.msg("修改成功",{time:1000, icon:1, shift:6},function () {
                        //关闭当前frame
                        xadmin.close();
                        // 可以对父窗口进行刷新
                        xadmin.father_reload();
                    });
                }else{
                    layer.msg(data.result, {time:1000, icon:2, shift:6},function () {});
                }
            },
        });
    }
    Date.prototype.toLocaleString = function() {
        return this.getFullYear() + "-" + (this.getMonth() + 1) + "-" + this.getDate() ;
    };
</script>

</body>

</html>

